<html>
<head><meta charset="utf-8"><title>build rlib only version of libstd · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html">build rlib only version of libstd</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="197400169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197400169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Hughes <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197400169">(May 13 2020 at 11:44)</a>:</h4>
<p>Hi, is it possible to recompile the stdlib to only emit static rlibs? I'm doing some experimental stuff in libstd which borks when linking <a href="http://libstd.so">libstd.so</a> so i'd like to turn it off for the time being. Thanks</p>



<a name="197401547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197401547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197401547">(May 13 2020 at 11:58)</a>:</h4>
<p><span class="user-mention" data-user-id="223286">@Jake Hughes</span> You can remove the <code>dylib</code> type from <code>crate-type = ["rlib", "dylib"]</code> in <code>libstd/Cargo.toml</code>. You can also completely remove that line, as <code>rlib</code> is the default for libraries.</p>



<a name="197402223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197402223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Hughes <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197402223">(May 13 2020 at 12:04)</a>:</h4>
<p>Oh perfect. Thanks <span class="user-mention" data-user-id="133247">@bjorn3</span> !  What's the reason for <code>dylib</code> in here? Is this incase one may want to dynamically link libstd if they use the same rustc version with a compatible abi?I was under the impression that libstd was always statically linked to a rust target.</p>



<a name="197402295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197402295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Hughes <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197402295">(May 13 2020 at 12:05)</a>:</h4>
<p>are there some parts of the rust ecosystem that rely on having libstd in <code>dylib</code> form?</p>



<a name="197402639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197402639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197402639">(May 13 2020 at 12:08)</a>:</h4>
<p>If any linked crate is a <code>dylib</code>, rustc will use the <code>dylib</code> variant of a crate whenever it is available. You can also use <code>-Cprefer-dynamic</code> to force using the <code>dylib</code> variant of all crates.</p>



<a name="197669435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197669435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197669435">(May 15 2020 at 09:52)</a>:</h4>
<blockquote>
<p>Jake Hughes: are there some parts of the rust ecosystem that rely on having libstd in dylib form?</p>
</blockquote>
<p>Testsuite for an example.</p>



<a name="197781967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197781967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197781967">(May 16 2020 at 07:24)</a>:</h4>
<p>Linux distributions ship std as a .so dynamic library.</p>



<a name="197790336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/build%20rlib%20only%20version%20of%20libstd/near/197790336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/build.20rlib.20only.20version.20of.20libstd.html#197790336">(May 16 2020 at 11:03)</a>:</h4>
<p>related issue: <a href="https://github.com/rust-lang/rust/issues/56443">https://github.com/rust-lang/rust/issues/56443</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>